﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using My.Application.Contracts.Orders;
using My.Application.Contracts.Orders.Dtos;
using My.WebApi.Filters;
using My.WebApi.Localization;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;

namespace My.WebApi.Controllers
{
    [Authorize]
    [ApiController]
    [Route("[controller]")]
    public class OrderController : AbpController
    {
        private readonly IOrderService _orderService;
        private readonly IStringLocalizer<TestResource> _localizer;

        public OrderController(IOrderService orderService,
            IStringLocalizer<TestResource> localizer)
        {
            _orderService = orderService;
            _localizer = localizer;
        }

        [AllowAnonymous]
        [HttpPost]
        public async Task CreateOrderAsync(CreateOrderDto input)
        {
            var str = _localizer["HelloWorld"];
            await _orderService.CreateOrderAsync(input);
        }

        [AllowAnonymous]
        [NotCheckUserLoginStatus]
        [HttpPost("Login")]
        public async Task LoginAsync()
        {
            var str = _localizer["HelloWorld"];
            await Task.CompletedTask;
        }
    }
}
